Implement wait_for_pending_update method#79
Conversation
e26582a to
b4ede03
Compare
b4ede03 to
c502a34
Compare
curquiza
left a comment
There was a problem hiding this comment.
Sorry for my shitty comments, so bad that the python linter does not see that. I feel more and more disappointed by this linter 😂
But there is still one important comment 😬
bidoubiwa
left a comment
There was a problem hiding this comment.
Could you add a test with interval = 0 ?
| return get_update | ||
| sleep(interval_in_ms/1000) | ||
| time_delta = datetime.now() - start_time | ||
| elapsed_time = time_delta.seconds * 1000 + time_delta.microseconds / 1000 |
There was a problem hiding this comment.
It uses the timedelta object to calculate the number of milliseconds since the moment the user called the wait_for_pending_update method. time_delta is an instance of a timedelta object, this just converts it to an int in ms
Co-authored-by: Clémentine Urquizar <clementine@meilisearch.com>
eskombro
left a comment
There was a problem hiding this comment.
Could you add a test with interval = 0 ?
@bidoubiwa whats would seem like a logical behaviour for you in that test? I don't really know what I could check other than if the function works or not
| return get_update | ||
| sleep(interval_in_ms/1000) | ||
| time_delta = datetime.now() - start_time | ||
| elapsed_time = time_delta.seconds * 1000 + time_delta.microseconds / 1000 |
There was a problem hiding this comment.
It uses the timedelta object to calculate the number of milliseconds since the moment the user called the wait_for_pending_update method. time_delta is an instance of a timedelta object, this just converts it to an int in ms
|
@eskombro The only behavior is indeed for me that it should not crash. Since there are divisions going on I always prefer if the zero values are tested. |
Based on this discussion, SDKs must provide a method that waits synchronously for an update to be processed by MeiliSearch.
Parameters:
update_id: id of the update to be waitedOptional parameters:
timeout_in_msmax number of millisecond this method should wait before rising aTimeoutError(default=2000ms)interval_in_msnumber of millisecond to set an interval of time this method should wait (sleep) between requests (default=10ms)tests
wait_for_pending_updatemethod in theIndexclassCloses #64